Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnC - Tell the debugger about updated type def tokens #53217

Merged
merged 13 commits into from
May 17, 2021

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented May 6, 2021

Fixes #52585

@davidwengier davidwengier requested a review from tmat May 6, 2021 05:57
@tmat
Copy link
Member

tmat commented May 8, 2021

public class EditAndContinueTests : EditAndContinueTestBase

Do we have tests that verify updated types for synthesized types? Local function/lambda's closures, state machines, the <Module> type, anonymous types, etc. Also a test with updated generic type.


Refers to: src/Compilers/CSharp/Test/Emit/Emit/EditAndContinue/EditAndContinueTests.cs:29 in d37f7cc. [](commit_id = d37f7cce7f3dbe1038c8f9a8991cc916dc008722, deletion_comment = False)

@tmat
Copy link
Member

tmat commented May 8, 2021

Let's target main. I don't think we need this in 16.1x. If we need to we can then back port. In general we shouldn't make changes to -vs-deps unless absolutely necessary since it just makes harder to work in main.

@davidwengier davidwengier changed the base branch from release/dev16.10-vs-deps to main May 10, 2021 02:58
@davidwengier davidwengier requested a review from a team as a code owner May 10, 2021 02:58
@davidwengier
Copy link
Contributor Author

In general we shouldn't make changes to -vs-deps unless absolutely necessary

The debugger API that this needs isn't in main yet, which is why I targeted 16.10-vs-deps. I'm happy to not take this for 16.1x, but at the moment we still need to target main-vs-deps for the debugger contracts library.

@davidwengier davidwengier changed the base branch from main to main-vs-deps May 10, 2021 03:15
@tmat
Copy link
Member

tmat commented May 10, 2021

The changes in the PR do not depend on the debugger API. Passing it to the debugger can only be done in -vs-deps, but all other changes can be in main.

_typeDefs is used to keep track of added type defs, but if we use it for updated type defs too then we start getting duplicate entries in the EnC log, but at the time that we output that log we can't tell which is the better entries to output.

Easier to leave the EnC log alone, since it works, and just add something new to keep track of every update.
@davidwengier davidwengier changed the base branch from main-vs-deps to main May 11, 2021 00:12
@davidwengier
Copy link
Contributor Author

Okay, I've retargeted to main.

Do we have tests that verify updated types for synthesized types? Local function/lambda's closures, state machines, the <Module> type, anonymous types, etc. Also a test with updated generic type.

I've added verification to existing tests that cover those scenarios. Couldn't get <Module> working, looks like compiler changes would be needed to support that. Logged #53310

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@davidwengier
Copy link
Contributor Author

@dotnet/roslyn-compiler can I get a couple of reviews?

EmitResult.UpdatedMethods.Select(methodHandle => $"0x{MetadataTokens.GetToken(methodHandle):X8}"));
}

public void VerifyUpdatedTypes(params string[] expecedTypeTokens)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: spelling

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Will fix, and merge

@@ -34,6 +34,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Emit
Dim serializationProperties = compilation.ConstructModuleSerializationProperties(emitOpts, runtimeMDVersion, baseline.ModuleVersionId)
Dim manifestResources = SpecializedCollections.EmptyEnumerable(Of ResourceDescription)()

Dim updatedMethods = ArrayBuilder(Of MethodDefinitionHandle).GetInstance()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was confused by this as these don't look used (aside from ToImmutableAndFree()). Is there more work coming later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're passed to SerializeToDeltaStreams on line 86. On the off chance this comment was meant for another location, there is another spot that probably has these arrays and there are changes coming in future, but the API is only in -vs-deps.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I failed to use one of the following correctly:

  1. My eyes
  2. My code review tool

😄

@davidwengier davidwengier enabled auto-merge (squash) May 17, 2021 20:50
@davidwengier davidwengier merged commit c1d0a97 into dotnet:main May 17, 2021
@ghost ghost added this to the Next milestone May 17, 2021
@davidwengier davidwengier deleted the EnCUpdatedTypeDefs branch May 17, 2021 23:57
333fred added a commit to 333fred/roslyn that referenced this pull request May 20, 2021
…vice-featureslayer

* upstream/main: (857 commits)
  Update contrib documentation (dotnet#53504)
  SImplify
  Fix out of bound crash in lsp navto.
  Revert changes to TypeScriptWaitContext wrappers
  Switch to ROSLYN_TEST_CI for CI detection
  SImplify
  Simplify LoggerTestChannel using BlockingCollection
  Only require telemetry validation in CI
  Fix out of bound crash in lsp navto.
  Fix locked comment
  Update Compiler Test Plan.md (dotnet#53420)
  Adjust doc comment for NullableWalker.VisitConversion (dotnet#53429)
  Revert "Infer delegate types with -langversion:preview only (dotnet#53241)" (dotnet#53466)
  Fix syntax normalizer to add space around before colon in constructor initializer (dotnet#53326)
  Remove unnecessary property (dotnet#53406)
  EnC - Tell the debugger about updated type def tokens (dotnet#53217)
  Revert an error
  Update PublishData.json
  Keep trailing trivia so single line if statements don't get badly formatted (dotnet#53414)
  Fix dead test code (dotnet#53416)
  ...
@RikkiGibson RikkiGibson modified the milestones: Next, 17.0.P2 Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnC: Calculate updated type definition tokens and pass it to the debugger
5 participants